function replaceUserInfo(oldUserName, newUserName, date, newTime) {
    let userNames = $x('//span[text()="' + oldUserName + '"]');

    userNames.forEach(function (userNameNode) {
        userNameNode.innerText = newUserName
    });

    let times = $x('//span[starts-with(text(),"' + date + '")]');

    if (date && newTime) {
        times.forEach(function (timeNode) {
            timeNode.innerText = newTime;
            let timeStamp = timeToTimestamp(newTime) - 2000;
            newTime = timestampToTime(timeStamp);
            console.log(newTime);
        })
    }
}

// 北京时间：2021-11-18 22:14:24
/* 时间yyyy-MM-dd HH:mm:ss转为时间戳 */
function timeToTimestamp(time) {
    let timestamp = Date.parse(new Date(time).toString());
    //timestamp = timestamp / 1000; //时间戳为13位需除1000，时间戳为13位的话不需除1000
    console.log(time + "的时间戳为：" + timestamp);
    return timestamp;
    //2021-11-18 22:14:24的时间戳为：1637244864707
}


// 时间戳：1637244864707
/* 时间戳转换为时间 */
function timestampToTime(timestamp) {
    timestamp = timestamp ? timestamp : null;
    let date = new Date(timestamp);//时间戳为10位需*1000，时间戳为13位的话不需乘1000
    let Y = date.getFullYear() + '-';
    let M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
    let D = (date.getDate() < 10 ? '0' + date.getDate() : date.getDate()) + ' ';
    let h = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':';
    let m = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':';
    let s = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds();
    return Y + M + D + h + m + s;
}

replaceUserInfo('t**', '鞠**', '2023', '2023-12-13 11:25:12')